package com.itheima.edu.info.manager.service;

import com.itheima.edu.info.manager.dao.StudentDao;
import com.itheima.edu.info.manager.domain.Student;

public class StudentService {
    StudentDao studentDao = new StudentDao();
    public boolean findStudent(String id) {
        Student[] stu =studentDao.findStudent();
        for (int i = 0; i < stu.length; i++) {
            Student stu1 = stu[i];
            if (stu1!=null&&stu1.getId().equals(id)){
                return true;
            }
        }
        return false;
    }

    public Student[] findAllStudent() {
        return studentDao.findStudent();

    }

    public void addStudent(Student student) {
        studentDao.addStudent(student);
    }

    public void deleteStudent(String id) {
        studentDao.deleteStudent(id);
    }

    public void updataStudent(String id, Student student) {
        studentDao.updataStudent(id,student);
    }
}
